package com.example.demo.serivce;

import com.example.demo.mapper.UserMapper;
import com.example.demo.model.Blog;
import com.example.demo.model.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserService {

    // 记得要注入
    @Resource
    private UserMapper userMapper;

    public List<Blog> getAll() {
        return userMapper.getAll();
    }

    public Integer insert(User user) {
        return userMapper.insert(user);
    }

    public void insert2(User user) {
        userMapper.insert2(user);
    }

    public Integer update(Integer userId, String password) {
        return userMapper.update(userId,password);
    }

    public Integer delete(Integer userId) {
        return userMapper.delete(userId);
    }

    public List<User> getall2(String sort) {
        return userMapper.getall2(sort);
    }

    public List<User> getAll3(String username, String password) {
        return userMapper.getAll3(username,password);
    }

    public List<User> findLike(String username) {
        return userMapper.findLike(username);
    }

    public List<Blog> getUserById(Integer userId) {
        return userMapper.getUserById(userId);
    }

    public Integer insert4(Blog blog) {
        return userMapper.insert4(blog);
    }

    public Integer insert5(Blog blog) {
        return userMapper.insert5(blog);
    }

    public List<Blog> selectAll(Integer userId, Integer blogId) {
        return userMapper.selectAll(userId,blogId);
    }

    public Integer testUpdate(User user) {
        return userMapper.testUpdate(user);
    }

    public Integer testDe(List<Integer> list) {
        return userMapper.testDe(list);
    }
}
